Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(lib): resolve FIXME messages #3348

Merged
merged 1 commit into from
Oct 20, 2023
Merged

Conversation

aliu
Copy link
Contributor

@aliu aliu commented Oct 15, 2023

Remove outdated FIXME comments, and resolve FIXME regarding usage of MaybeUninit.

Since hyper's MSRV is higher now, we can use some new stabilized apis. I also removed some unsafe blocks related to MaybeUninit usage.

Remove outdated FIXME comments, and resolve FIXME regarding usage of
`MaybeUninit`.
/* SAFETY: it is safe to go from MaybeUninit array to array of MaybeUninit */
let mut headers: [MaybeUninit<httparse::Header<'_>>; MAX_HEADERS] =
unsafe { MaybeUninit::uninit().assume_init() };
let mut headers = [MaybeUninit::<httparse::Header<'_>>::uninit(); MAX_HEADERS];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this result in the same generated code? Or at least same performance? I mean, logically it makes sense. But it doesn't initialize an array to then declare the stuff inside is uninitialized, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The generated code in debug-mode is slightly different, but in release mode it's identical. Here is a link to the assembly: https://godbolt.org/z/6rvbz8qWd

@seanmonstar seanmonstar merged commit 07077e9 into hyperium:master Oct 20, 2023
19 checks passed
@aliu aliu deleted the fixme branch November 19, 2023 01:43
0xE282B0 pushed a commit to 0xE282B0/hyper that referenced this pull request Jan 12, 2024
Remove outdated FIXME comments, and resolve FIXME regarding usage of
`MaybeUninit`.
0xE282B0 pushed a commit to 0xE282B0/hyper that referenced this pull request Jan 16, 2024
Remove outdated FIXME comments, and resolve FIXME regarding usage of
`MaybeUninit`.

Signed-off-by: Sven Pfennig <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants